import { http } from "@/utils/http";
import baseUrlProxy from "@/api/baseUrlProxy";
export type VppEquipmentItem = {
  id: number;
  vppTerminalId: number;
  equipSeqNo: number;
  equipType: number;
  status: number;
  equipStatus: number;
  name: string;
  equipMaker: string;
  equipDescr: string;
  initOnlineTime: string;
  onlineTime: string;
  offlineTime: string;
  pKey: string;
  qKey: string;
  equipStatusKey: string;
  contactName: string;
  contactTel: string;
  createBy: string;
  createTime: string;
  updateBy: string;
  updateTime: string;
};
export type ResultEquipmentList = {
  content: VppEquipmentItem[];
  totalElements: number;
};

export const getVppEquipmentList = (data?: object) => {
  return http.request<ResultEquipmentList>(
    "get",
    baseUrlProxy + "/api/equipmentInfo",
    {
      params: data
    }
  );
};
export const getVppEquipmentDetail = id => {
  return http.request<VppEquipmentItem>(
    "get",
    baseUrlProxy + "/api/equipmentInfo/id/" + id
  );
};
export const addVppEquipmentList = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/equipmentInfo", {
    data: data
  });
};

export const editVppEquipmentList = (data?: object) => {
  return http.request<any>("put", baseUrlProxy + "/api/equipmentInfo", {
    data: data
  });
};

export const delVppEquipmentList = (data?: object) => {
  return http.request<any>("delete", baseUrlProxy + "/api/equipmentInfo", {
    data: data
  });
};

export const exportVppEquipmentList = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/equipmentInfo/download",
    { params: data },
    { responseType: "blob" }
  );
};
